import 'package:flutter/material.dart';
import 'package:xinxuan/common/appbar_util.dart';
import 'package:xinxuan/common/scroll_configuration_common.dart';
import 'package:get/get.dart';
import 'package:xinxuan/controllers/my_controller/about_us_page_controller.dart';
import 'package:xinxuan/router/app_routers.dart';
import 'package:x_common_utils/utils/inkWell_util.dart';
import 'package:xinxuan/utils/color_util.dart';
import 'package:xinxuan/vo/articles_list_vo.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class AboutUsPage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: pageBgColor,
      appBar: AppBarUtil(
        title: '关于我们',
        backgroundColor: bgWhiteColor,
      ),
      body: ScrollConfigurationCommon(child: ListView(
        children: [
          Container(
            alignment: Alignment.center,
            margin: EdgeInsets.symmetric(vertical: 30.h),
            child: Image.asset(
              'assets/images/icon_app_bg.png',
              width: 113.w,
              height: 113.w,
              fit: BoxFit.cover,
            ),
          ),
          GetBuilder<AboutUsPageController>(
            init: AboutUsPageController(),
            builder: (controller) {
              return Column(
                children: controller.articlesArr.asMap().keys.map((index) {
                  ArticlesItem articlesItem = controller.articlesArr[index];
                  return InkWellUtil.shakeProofInkWell(Container(
                    padding: EdgeInsets.symmetric(horizontal: 12.w),
                    color: bgWhiteColor,
                    child: Container(
                      padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 4.w),
                      decoration: BoxDecoration(
                        border: Border(
                          bottom: index < controller.articlesArr.length - 1 ? BorderSide(
                            color: lineColor,
                            width: .5
                          ) : BorderSide.none
                        )
                      ),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Text(
                            '${articlesItem.title}',
                            style: TextStyle(
                              color: textBlackColor,
                              fontSize: 16.sp
                            ),
                          ),
                          Container(
                            margin: EdgeInsets.only(left: 10.w),
                            child: Image.asset(
                              'assets/icons/icon_arrow_right.png',
                              width: 16.w,
                              height: 16.w,
                            ),
                          )
                        ],
                      ),
                    ),
                  ), () {
                    Get.toNamed(
                      '${AppRouters.COMMON_PAGE}${AppRouters.ARTICLE_DETAIL_PAGE}',
                      arguments: {
                        'articleId': articlesItem.id,
                        'title': articlesItem.title
                      }
                    );
                  });
                }).toList(),
              );
            },
          )
        ],
      )),
    );
  }
}